﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>议程</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    @Styles.Render("~/bundles/css")
    <link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all" />
    <style>
        .layui-form-item {
            margin-bottom: 0;
        }

        .layui-tree li i {
            color: #009688;
        }
    </style>
</head>
<body class="childrenBody">
    <div class="layui-row">
        <div class="layui-col-md3"><ul id="demo"></ul></div>
        <div class="layui-col-md9">

            <blockquote class="layui-elem-quote news_search layui-form search">
                <div class="layui-inline">
                    <div class="layui-input-inline">

                    </div>
                    <a class="layui-btn search_btn" data-type="search">查询</a>
                </div>
                <div class="layui-inline">
                    <a class="layui-btn layui-btn-normal usersAdd_btn" data-type="add">添加</a>
                </div>
                <div class="layui-inline">
                    <a class="layui-btn layui-btn-danger batchDel" data-type="deleteList">删除</a>
                </div>
                <div class="layui-inline">
                    <div class="layui-form-mid layui-word-aux"></div>
                </div>
            </blockquote>




            @*<div class="layui-body"></div>*@
            <div class="layui-form users_list">

                <table id="tbData" class="layui-table" lay-filter="btnClick" lay-data="{height: 'full-90',id: 'tableReload', cellMinWidth: 80,page: true, limit:10, url:'@Url.Action("getPageData")'}">
                    <thead>
                        <tr>
                            <th lay-data="{fixed: 'left',type:'checkbox'}">ID</th>
                            <th lay-data="{fixed: 'left',field:'aName', width:220, sort: true}">议程名称</th>
                            <th lay-data="{field:'startTime', width:140, sort: true}">开始时间</th>
                            <th lay-data="{field:'endTime', width:140, sort: true}">结束时间</th>
                            <th lay-data="{field:'guestNames', width:220, sort: true}">主讲嘉宾</th>
                            <th lay-data="{field:'address', width:200, sort: true}">地点</th>
                            <th lay-data="{fixed: 'right', width:178, align:'center', toolbar: '#barBtns'}"></th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div id="page"></div>


        </div>
    </div>
    <script src="~/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="~/layui/layui.js"></script>
    <script src="~/js/formRender.js"></script>
    <script src="~/js/list.js"></script>
    <script type="text/html" id="barBtns">
        <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
        var appUrl = '@Url.Action("")';
        var addUrl = '@Url.Action("Data")';
        var editUrl = '@Url.Action("Data")';
        var winWidth = '1000px';
        var winHeight = '600px';

        var nodesJson;

        $(document).ready(function () {
            var url = appUrl + "/getActivities";
            $.ajax({
                url: url,
                type: 'post',
                data: {
                    //ids: id
                },
                success: function (res) {
                    nodesJson = JSON.parse(res);
                    console.log(nodesJson);


                    layui.config({
                        base: appUrl + "js/"
                    }).use(['tree','table'], function () {
                        var table = layui.table;

                        layui.tree({
                            elem: '#demo' //传入元素选择器

                            , nodes: nodesJson
                            , click: function (node) {
                                console.log(node) //node即为当前点击的节点数据
                                var tableReload = $('#tableReload');
                                var data = {
                                    and: [],
                                    or: []
                                }

                                data.and.push({
                                    paraName: 'activityID', paraValue: node.id })
                                //执行重载
                                table.reload('tableReload', {
                                    page: {
                                        curr: 1 //重新从第 1 页开始
                                    }
                                    , where: {

                                        where: JSON.stringify(data)
                                    }
                                });
                            }
                        });
                    });
                }
            })
        });


    </script>
</body>
</html>

